import request from "@/utils/request";

export function archvieAudioCreatorAPI(params) {
    return request({
        url: "/x/v1/archive/audio/creator",
        method: "POST",
        data: {
            cid: params.cid,
            resources: params.resources,
            title: params.title,
            cover: params.cover,
            mark: params.mark,
        },
    });
}

export function archiveAudioFinderAPI(aid) {
    return request({
        url: `/x/v1/archive/audio/finder/${aid}`,
        method: "GET",
    });
}

export function archiveAudioUpdatorAPI(aid, params) {
    return request({
        url: `/x/v1/archive/audio/updator/${aid}`,
        method: "PUT",
        data: {
            cid: params.cid,
            resources: params.resources,
            title: params.title,
            cover: params.cover,
            mark: params.mark,
        },
    });
}

export function archiveAudioListFinderAPI(params, extendParams) {
    return request({
        url: "/x/v1/archive/audio/list/finder",
        method: "GET",
        params: {
            page: params.page,
            size: params.size,
            ...extendParams,
        }
    });
}

export function audioArchiveDestroyerAPI(rid) {
    return request({
        url: "/x/v1/archive/audio/destroyer/" + rid,
        method: "DELETE"
    })
}

export function audioResourceDestroyerAPI(rid) {
    return request({
        url: "/x/v1/resource/audio/destroyer/" + rid,
        method: "DELETE"
    })
}

export function audioResourceUpdatorAPI(rid, params) {
    return request({
        url: "/x/v1/resource/audio/updator/info/" + rid,
        method: "PUT",
        data: {
            name: params.name,
            artist: params.artist,
            mark: params.mark,
        }
    })
}

export function audioClassifyFinderAPI() {
    return request({
        url: "/x/v1/audio/classify/finder",
        method: "GET"
    })
}

export function audioClassifyCreatorAPI(params) {
    return request({
        url: "/x/v1/audio/classify/creator",
        method: "POST",
        data: {
            name: params.name
        }
    })
}

export function audioClassifyUpdatorAPI(cid, params) {
    return request({
        url: "/x/v1/audio/classify/updator/" + cid,
        method: "PUT",
        data: {
            name: params.name
        }
    })
}

export function audioClassifyDestroyerAPI(cid) {
    return request({
        url: "/x/v1/audio/classify/destroyer/" + cid,
        method: "DELETE"
    })
}